package com.zhuss.controller.core;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.version.CreateAppVersionBo;
import com.zhuss.bean.bo.core.version.SearchAppVersionBo;
import com.zhuss.common.BaseController;
import com.zhuss.core.db.dao.gen.AppVersionMapper;
import com.zhuss.core.db.entity.AppVersion;
import com.zhuss.core.processor.AppVersionRead;

/**
 * 查看版本更新
 * @author gavin
 *
 */

@RestController
@RequestMapping("/appVersion")
public class AppVersionController extends BaseController{
	@Autowired
	private AppVersionRead appVersionRead;
	
	@Autowired
	private AppVersionMapper appVersionMapper;
	
	

	/**
	 * 列表
	 */
	@PostMapping("/list")
	public Object list(@RequestBody SearchAppVersionBo bo) {
		Object result = appVersionRead.list(bo);
		return result;
	}
	
	/**
	 * 添加
	 */
	@PostMapping("/create")
	public void create(@RequestBody CreateAppVersionBo bo) {
		AppVersion av = new AppVersion();
		Date day = new Date();
		av.setVersion(bo.getVersion());
		av.setApkUrl(bo.getApkUrl());
		av.setUpdateUrl(bo.getUpdateUrl());
		av.setCreatTime(day);
		av.setUpdateTime(day);
		av.setDeleted(0);
		appVersionMapper.insertSelective(av);
	}
	

}
